Release 10.1A: OpenEdge Development:
ProDataSets
Creating or defining the before-tables
For a dynamic temp-table, a before-table is created only when the temp-table’s
TRACKING-CHANGESattribute (or the corresponding ProDataSet attribute) is first set toTRUE. After that the before-table remains in existence for the life of the after-table, even asTRACKING-CHANGESis set toFALSEand back toTRUE.When you pass a ProDataSet parameter, if the receiving procedure receives the ProDataSet as a dynamic object (as a
DATASET-HANDLE), then Progress automatically creates a before-table for each modified temp-table if one does not already exist.In the case of a static temp-table that might be used to track changes as part of a ProDataSet, you must provide a static name for its before-table by naming it in the
DEFINE TEMP-TABLEstatement, as shown:
Progress cannot create a before-table for you at run time as it does for dynamic tables. Procedure code can refer to the before-table by name exactly as it does other temp-tables, except that any attempt to modify its records in any way results in a run-time error. For a static definition, the before-table is instantiated along with the after-table, and you can freely refer to it in procedural code. Until the temp-table is associated with a ProDataSet and
TRACKING-CHANGESset to true for the after-table, the before-table simply is empty.When you pass a ProDataSet parameter, if the receiving procedure receives the ProDataSet as a static object, then its static definition must include a static name for the before-table. Otherwise, Progress does not create a before-table and raises an error. Figure 6–1 shows how the before-table and after-table are related.
Figure 6–1: Relationship of before- and after-tables
![]()
Actually, the before-table has a nonunique index on the
ROW-STATE, so that changes are in order with delete operations first, then modify operations, then create operations.Both the before-table and after-table are part of the ProDataSet. They are passed together as part of the ProDataSet parameter and have the same scope and lifetime, with the exception that a before-table for a dynamic temp-table is created only when first needed. The arrows illustrate the four states and relationships:
- When
OrderLine09is modified, the before image is copied to a new record in the before-table. TheROW-STATEfor both records isROW-MODIFIED, represented by theMin the illustration. TheROW-STATEis not actually stored as a user-accessible temp-table column. It is accessible only through theROW-STATEattribute.- When row
11is created, a placeholder for it is created in the before-table. It serves only to log the creation and point to the record in the after-table.- When row
22is deleted, it is removed from the after-table and moved to the before-table.- Rows
10and77have aROW-STATEin the after-table ofROW-UNMODIFIED, represented by theU. There is no corresponding row in the before-table.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |